package com.okq.action;

import com.okq.action.base.BaseActionSupport;
import com.okq.entity.*;
import com.okq.service.*;
import com.okq.util.BaseTool;
import com.okq.util.PublicClass;
import com.okq.util.TimeTool;
import com.okq.util.page.Page;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 描述 : 人员action
 * 作者 : zdl
 * 日期 : 2017/6/28 11:02
 */
public class UserAction extends BaseActionSupport {

    private static final long serialVersionUID = 8299286045632049760L;

    /**
     * 公司接口
     */
    @Autowired
    private ICompanyService companyServiceImpl;
    /**
     * 部门接口
     */
    @Autowired
    private IGroupService groupServiceImpl;
    /**
     * 角色接口
     */
    @Autowired
    private IRoleService roleServiceImpl;
    /**
     * 人员接口
     */
    @Autowired
    private IUserService userServiceImpl;
    /**
     * 系统日志接口
     */
    @Autowired
    private ILogService logServiceImpl;
    /**
     * 日志
     */
    private static final Logger logger = Logger.getLogger(UserAction.class);
    /**
     * 分页开始条数
     */
    private int iDisplayStart;

    /**
     * 每页显示条数
     */
    private int iDisplayLength;

    private String id;
    private User user;
    private String type;
    private String companyId;
    private String companyName;
    private String groupName;
    private String roleName;
    private String ids;// 选中人员id字符串
    private String searchName;// 搜索名称

    /**
     * 获取人员列表
     *
     * @return json
     */
    public String getUserList() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null) {
                if (iDisplayLength == 0) {
                    iDisplayLength = -1;
                }
                int pageNum = (int) (Math.ceil(iDisplayStart / iDisplayLength)) + 1;
                /* 分页信息 */
                Page<User> pageInfo = new Page<>(iDisplayLength);
                pageInfo.setPageNo(pageNum);
                /* 权限控制 开始 */
                String groupIds = getGroupIds(loginUser);
                /* 权限控制 结束 */
                pageInfo = userServiceImpl.pageByUser(pageInfo, user, groupIds);
                int iTotalRecords = pageInfo.getTotalCount();
                int iTotalDisplayRecords = pageInfo.getTotalCount() < 0 ? 0 : pageInfo.getTotalCount();
                /* 得到结果 */
                List<User> uList = pageInfo.getResult();
                /* 封装list */
                List<Map<String, Object>> uMapList = new ArrayList<>();
                if (uList != null && !uList.isEmpty() && uList.size() > 0) {
                    int i = (pageNum - 1) * iDisplayLength + 1;
                    for (User u : uList) {
                        Map<String, Object> map = new HashMap<>();
                        map.put("no", i);// 序号
                        map.put("id", u.getId());
                        map.put("loginUserId", loginUser.getId());
                        map.put("userName", StringUtils.defaultString(u.getUserName(), ""));
                        map.put("loginName", StringUtils.defaultString(u.getLoginName(), ""));
                        map.put("cellphone", StringUtils.defaultString(u.getCellphone(), ""));
                        Integer sex = u.getSex();
                        String sexStr;
                        if (sex == 0) {
                            sexStr = "女";
                        } else {
                            sexStr = "男";
                        }
                        map.put("sexStr", sexStr);
                        map.put("age", u.getAge() != null ? u.getAge() : "");
                        map.put("email", StringUtils.defaultString(u.getEmail(), ""));
                        String groupId = u.getGroupId();
                        String groupName = "";
                        if (StringUtils.isNotBlank(groupId)) {
                            Group g = groupServiceImpl.getGroupById(groupId);
                            if (g != null) {
                                groupName = StringUtils.defaultString(g.getGroupName(), "");
                            }
                        }
                        map.put("groupName", groupName);
                        String roleId = u.getRoleId();
                        String roleName = "";
                        Integer roleType = 0;
                        if (StringUtils.isNotBlank(roleId)) {
                            Role r = roleServiceImpl.getRoleById(roleId);
                            if (r != null) {
                                roleName = StringUtils.defaultString(r.getRoleName(), "");
                                roleType = r.getRoleType();
                            }
                        }
                        map.put("roleName", roleName);
                        map.put("roleType", roleType);
                        map.put("createUser", StringUtils.defaultString(u.getCreateUserName(), ""));
                        map.put("createTime", TimeTool.timestampToString(u.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
                        uMapList.add(map);
                        i++;
                    }
                }
                Map<String, Object> jsonMap = new HashMap<>();
                jsonMap.put("iTotalRecords", iTotalRecords);
                jsonMap.put("iTotalDisplayRecords", iTotalDisplayRecords);
                jsonMap.put("aaData", uMapList);

                String json = BaseTool.toJson(jsonMap);
                out.print(json);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 删除
     *
     * @return 是否成功标识
     */
    public String deleteUser() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && StringUtils.isNotBlank(id)) {
                if (!id.equals(loginUser.getId())) {
                    User u = userServiceImpl.getUserById(id);
                    if (u != null) {
                        u.setIsDelete(1);
                        u.setUpdateUserId(loginUser.getId());
                        u.setUpdateUserName(loginUser.getUserName());
                        userServiceImpl.updateUser(u);
                        out.print(0);
                        //添加系统日志
                        String userName = loginUser.getUserName();
                        String nowTime = TimeTool.getNowTime();
                        String content = "用户：" + userName + "，于" + nowTime + " 删除用户：" + u.getUserName() + "！";
                        PublicClass.addLog(userName, loginUser.getLoginName(), "用户管理", 2, content, logServiceImpl);
                    }
                } else {
                    out.print(2);
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 跳转到修改/详情页面
     *
     * @return update/detail
     */
    public String toUpdateOrDetail() {
        try {
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && StringUtils.isNotBlank(id)) {
                user = userServiceImpl.getUserById(id);
                if (user != null) {
                    String comCode = user.getComCode();
                    findCompany(comCode);
                    Group g = groupServiceImpl.getGroupById(user.getGroupId());
                    if (g != null) {
                        groupName = g.getGroupName();
                    }
                    Role r = roleServiceImpl.getRoleById(user.getRoleId());
                    if (r != null) {
                        roleName = r.getRoleName();
                    }
                    if (type.equals("update")) {
                        return "update";
                    } else if (type.equals("detail")) {
                        return "detail";
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        }
        return null;
    }

    /**
     * 验证手机号唯一性
     *
     * @return 验证成功标识
     */
    public String validatePhone() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && user != null) {
                String userId = user.getId();
                String cellPhone = user.getCellphone();
                boolean needValidate = false;
                if (StringUtils.isNotBlank(userId)) {// 修改时
                    User oldUser = userServiceImpl.getUserById(userId);
                    String oldPhone = oldUser.getCellphone();
                    if (!cellPhone.equals(oldPhone)) {
                        needValidate = true;
                    }
                } else {
                    needValidate = true;
                }
                if (needValidate) {
                    if (StringUtils.isNotBlank(cellPhone)) {
                        User u = userServiceImpl.getUserByPhone(cellPhone);
                        if (u != null) {
                            out.print(1);
                        }
                    }
                }

            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 跳转到个人信息页面
     *
     * @return SUCCESS
     */
    public String toUser() {
        try {
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null) {
                user = userServiceImpl.getUserById(loginUser.getId());
                if (user != null) {
                    String comCode = user.getComCode();
                    findCompany(comCode);
                    Group g = groupServiceImpl.getGroupById(user.getGroupId());
                    if (g != null) {
                        groupName = g.getGroupName();
                    }
                    Role r = roleServiceImpl.getRoleById(user.getRoleId());
                    if (r != null) {
                        roleName = r.getRoleName();
                    }
                    return SUCCESS;
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        }
        return null;
    }

    /**
     * 根据公司编码获取公司id和name
     *
     * @param comCode 公司编码
     */
    private void findCompany(String comCode) {
        try {
            if (StringUtils.isNotBlank(comCode)) {
                Company c = companyServiceImpl.getCompanyByComCode(comCode);
                if (c != null) {
                    companyId = c.getId();
                    companyName = c.getName();
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }

    /**
     * 保存
     *
     * @return 是否成功标识
     */
    public String saveUser() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && user != null) {
                Company c = null;
                if (StringUtils.isNotBlank(companyId)) {
                    c = companyServiceImpl.getCompanyById(companyId);
                    if (c == null) {
                        out.print("comexist");
                        return null;
                    }
                }
                String groupId = user.getGroupId();
                if (StringUtils.isNotBlank(groupId)) {
                    Group g = groupServiceImpl.getGroupById(groupId);
                    if (g == null) {
                        out.print("groupexist");
                        return null;
                    }
                }
                String roleId = user.getRoleId();
                if (StringUtils.isNotBlank(roleId)) {
                    Role r = roleServiceImpl.getRoleById(roleId);
                    if (r == null) {
                        out.print("roleexist");
                        return null;
                    }
                }
                if (StringUtils.isNotBlank(type) && type.equals("add")) {// 新增
                    User u = userServiceImpl.getUserByLoginName(user.getLoginName());
                    if (u != null) {
                        out.print("exist");
                        return null;
                    } else {
                        String comCode = "";
                        if (c != null) {
                            comCode = c.getComCode();
                        }
                        user.setId(BaseTool.getPK());
                        String loginPass = user.getLoginPass();
                        String passMD5 = "";
                        if (StringUtils.isNotBlank(loginPass)) {
                            passMD5 = BaseTool.getMD5Encryption(loginPass);
                        }
                        if (StringUtils.isNotBlank(passMD5)) {
                            user.setLoginPass(passMD5);
                        }
                        if (StringUtils.isNotBlank(comCode)) {
                            user.setComCode(comCode);
                        }
                        String userName = loginUser.getUserName();
                        if (StringUtils.isNotBlank(userName)) {
                            user.setCreateUserId(loginUser.getId());
                            user.setCreateUserName(userName);
                        }
                        userServiceImpl.saveUser(user);
                        out.print("success");
                        //添加系统日志
                        String nowTime = TimeTool.getNowTime();
                        String content = "用户：" + userName + "，于" + nowTime + " 添加用户：" + user.getUserName() + "！";
                        PublicClass.addLog(userName, loginUser.getLoginName(), "用户管理", 2, content, logServiceImpl);
                    }
                } else if (StringUtils.isNotBlank(type) && (type.equals("update") || type.equals("set"))) {// 修改
                    String newName = user.getLoginName();
                    User oldUser = userServiceImpl.getUserById(user.getId());
                    if (oldUser != null) {
                        String oldName = oldUser.getLoginName();
                        if (StringUtils.isNotBlank(newName) && StringUtils.isNotBlank(oldName) && !newName.equals(oldName)) {
                            User u = userServiceImpl.getUserByLoginName(newName);
                            if (u != null) {
                                out.print("exist");
                                return null;
                            }
                        }
                        oldUser.setUserName(user.getUserName());
                        oldUser.setLoginName(newName);
                        oldUser.setCellphone(user.getCellphone());
                        oldUser.setTelephone(user.getTelephone());
                        oldUser.setSex(user.getSex());
                        oldUser.setAge(user.getAge());
                        oldUser.setEmail(user.getEmail());
                        if (type.equals("update")) {
                            oldUser.setGroupId(user.getGroupId());
                            oldUser.setRoleId(user.getRoleId());
                        }
                        String userName = loginUser.getUserName();
                        if (StringUtils.isNotBlank(userName)) {
                            oldUser.setUpdateUserId(loginUser.getId());
                            oldUser.setUpdateUserName(userName);
                        }
                        userServiceImpl.updateUser(oldUser);
                        if (type.equals("set")) {
                            this.getRequest().getSession().setAttribute("loginUser", oldUser);
                        }
                        out.print("success");
                        //添加系统日志
                        String nowTime = TimeTool.getNowTime();
                        String content = "用户：" + userName + "，于" + nowTime + " 修改用户：" + user.getUserName() + "！";
                        PublicClass.addLog(userName, loginUser.getLoginName(), "用户管理", 2, content, logServiceImpl);
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 控制公司管理员查询权限
     *
     * @param loginUser 登录用户
     * @return groupIds
     */
    private String getGroupIds(User loginUser) {
        String groupIds = "";
        try {
            String loginRoleId = loginUser.getRoleId();
            if (StringUtils.isNotBlank(loginRoleId)) {
                Role role = roleServiceImpl.getRoleById(loginRoleId);
                if (role != null) {
                    Integer roleType = role.getRoleType();
                    if (roleType == 1) {// 管理员能看到自己所属公司下所有的部门人员
                        String comCode = loginUser.getComCode();
                        if (StringUtils.isNotBlank(comCode)) {
                            Company company = companyServiceImpl.getCompanyByComCode(comCode);
                            if (company != null) {
                                List<Group> gList = groupServiceImpl.listGroupByComId(company.getId());
                                if (gList != null && !gList.isEmpty() && gList.size() > 0) {
                                    for (Group g : gList) {
                                        groupIds += g.getId() + ",";
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (StringUtils.isNotBlank(groupIds)) {
                groupIds = groupIds.substring(0, groupIds.length() - 1);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return groupIds;
    }

    /**
     * 获取选中人员的名称
     *
     * @return userName
     */
    public String getUserName() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && StringUtils.isNotBlank(ids)) {
                StringBuffer sb = new StringBuffer();
                String[] idsArr = ids.split(",");
                Map<String, String> map = new HashMap<>();
                if (idsArr.length > 0) {
                    for (String userId : idsArr) {
                        User user = userServiceImpl.getUserById(userId);
                        String userName = user.getUserName();
                        if (StringUtils.isNotBlank(userName)) {
                            map.put(user.getId(), userName);
                        } else {
                            map.put(user.getId(), user.getLoginName());
                        }
                    }
                    for (Map.Entry<String, String> entry : map.entrySet()) {
                        sb.append(entry.getKey()).append("；");// 中文的；号
                    }
                    if (map.size() > 0) {
                        sb = sb.deleteCharAt(sb.length() - 1);
                    }
                    out.print(sb.toString());
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 选择人员树形菜单
     *
     * @return json
     */
    @SuppressWarnings("all")
    public String selectUser() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null) {
                List<TreeNode> treeNodes = new ArrayList<>();
                String loginRoleId = loginUser.getRoleId();
                if (StringUtils.isNotBlank(loginRoleId)) {
                    Role role = roleServiceImpl.getRoleById(loginRoleId);
                    if (role != null) {
                        Integer roleType = role.getRoleType();
                        if (roleType == 0) {// 超级管理员能查询所有公司下所有部门的人员
                            List<Company> cList = companyServiceImpl.listAllCompany();
                            if (cList != null && !cList.isEmpty() && cList.size() > 0) {
                                for (Company c : cList) {
                                    TreeNode ct = new TreeNode();
                                    ct.setId("cid_" + c.getId());
                                    ct.setName(c.getName());
                                    ct.setpId("cid_0");
                                    ct.setParent(true);
                                    treeNodes.add(ct);
                                }
                                List<Group> gList = groupServiceImpl.listAllGroup();
                                if (gList != null && !gList.isEmpty() && gList.size() > 0) {
                                    for (Group g : gList) {
                                        TreeNode gt = new TreeNode();
                                        gt.setId("gid_" + g.getId());
                                        gt.setName(g.getGroupName());
                                        gt.setpId("cid_" + g.getCompanyId());
                                        gt.setParent(true);
                                        treeNodes.add(gt);
                                    }
                                    List<User> uList = userServiceImpl.listAllUser();
                                    treeNodes = findUserTreeNodes(treeNodes, uList);
                                }
                            }
                        } else if (roleType == 1) {// 管理员能看到自己所属公司下所有的部门人员
                            String comCode = loginUser.getComCode();
                            if (StringUtils.isNotBlank(comCode)) {
                                Company company = companyServiceImpl.getCompanyByComCode(comCode);
                                if (company != null) {
                                    List<Group> gList = groupServiceImpl.listGroupByComId(company.getId());
                                    treeNodes = findTreeNodes(treeNodes, gList);
                                }
                            }
                        }
                    }
                }
                String jsons = BaseTool.toJson(treeNodes);
                out.print(jsons);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 根据公司ID加载人员属性菜单
     *
     * @return json
     */
    public String selectUserByComId() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && StringUtils.isNotBlank(companyId)) {
                List<TreeNode> treeNodes = new ArrayList<>();
                Company company = companyServiceImpl.getCompanyById(companyId);
                if (company != null) {
                    List<Group> gList = groupServiceImpl.listGroupByComId(company.getId());
                    treeNodes = findTreeNodes(treeNodes, gList);
                }
                String json = BaseTool.toJson(treeNodes);
                out.print(json);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 获取树节点
     *
     * @param treeNodes 树节点
     * @param gList     部门list
     * @return 部门树节点
     */
    private List<TreeNode> findTreeNodes(List<TreeNode> treeNodes, List<Group> gList) {
        try {
            if (gList != null && !gList.isEmpty() && gList.size() > 0) {
                String gIds = "";
                for (Group g : gList) {
                    gIds += g.getId() + ",";
                    TreeNode gt = new TreeNode();
                    gt.setId("gid_" + g.getId());
                    gt.setName(g.getGroupName());
                    gt.setpId("gid_0");
                    gt.setParent(true);
                    treeNodes.add(gt);
                }
                if (gIds.endsWith(",")) {
                    gIds = gIds.substring(0, gIds.length() - 1);
                }
                List<User> uList = userServiceImpl.listUserByGroupIds(gIds);
                treeNodes = findUserTreeNodes(treeNodes, uList);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return treeNodes;
    }

    /**
     * 获取人员树节点
     *
     * @param treeNodes 树节点
     * @param uList     人员list
     * @return 人员树节点
     */
    private List<TreeNode> findUserTreeNodes(List<TreeNode> treeNodes, List<User> uList) {
        try {
            if (uList != null && !uList.isEmpty() && uList.size() > 0) {
                for (User u : uList) {
                    TreeNode ut = new TreeNode();
                    ut.setId("uid_" + u.getId());
                    ut.setName(u.getUserName());
                    ut.setpId("gid_" + u.getGroupId());
                    treeNodes.add(ut);
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return treeNodes;
    }

    /**
     * 跳转到修改密码页面
     *
     * @return SUCCESS
     */
    public String toPwdSet() {
        try {
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null) {
                user = userServiceImpl.getUserById(loginUser.getId());
                if (user != null) {
                    return SUCCESS;
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        }
        return null;
    }

    /**
     * 验证原密码
     *
     * @return 验证成功标识
     */
    public String validatePwd() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            if (StringUtils.isNotBlank(id)) {
                User u = userServiceImpl.getUserById(id);
                if (u != null) {
                    String pwd = user.getLoginPass();// 修改页面输入的原密码
                    String uPwd = u.getLoginPass();// 用户登录密码
                    if (StringUtils.isNotBlank(pwd) && StringUtils.isNotBlank(uPwd)) {
                        String pwdMD5 = BaseTool.getMD5Encryption(pwd);
                        if (!pwdMD5.equals(uPwd)) {
                            out.print(1);
                        }
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    /**
     * 修改密码
     *
     * @return 是否成功标识
     */
    public String updatePwd() {
        PrintWriter out = null;
        try {
            out = this.getResponse().getWriter();
            User loginUser = (User) getSession().getAttribute("loginUser");
            if (loginUser != null && StringUtils.isNotBlank(id)) {
                User u = userServiceImpl.getUserById(id);
                if (u != null) {
                    String newPass = user.getLoginPass();
                    if (StringUtils.isNotBlank(newPass)) {
                        u.setLoginPass(BaseTool.getMD5Encryption(newPass));
                        String userName = loginUser.getUserName();
                        if (StringUtils.isNotBlank(userName)) {
                            u.setUpdateUserId(loginUser.getId());
                            u.setUpdateUserName(userName);
                        }
                        userServiceImpl.updateUser(u);
                        out.print(0);
                    }
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            return null;
        } finally {
            if (out != null) {
                out.close();
            }
        }
        return null;
    }

    public int getIDisplayStart() {
        return iDisplayStart;
    }

    public void setIDisplayStart(int iDisplayStart) {
        this.iDisplayStart = iDisplayStart;
    }

    public int getIDisplayLength() {
        return iDisplayLength;
    }

    public void setIDisplayLength(int iDisplayLength) {
        this.iDisplayLength = iDisplayLength;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getIds() {
        return ids;
    }

    public void setIds(String ids) {
        this.ids = ids;
    }

    public String getSearchName() {
        return searchName;
    }

    public void setSearchName(String searchName) {
        this.searchName = searchName;
    }

}
